﻿// +------------------------------------------------+---------------+
// | Automatic Checkbox Unchecker                   | Version 1.0.0 |
// +------------------------------------------------+---------------+
// | Automatically unchecks any listed checkbox present on          |
// | listed websites while running. This may be used to prevent     |
// | installing crapware bundled with webinstalls by known vendors. |
// +----------------------------------------------------------------+
// | Copyrright R 2014 ŁSL Scripting.                               |
// | Redistribution and use in source and binary forms,             |
// | with or without modification, are permitted provided           |
// | that the following conditions are met:                         |
// | 1. Redistributions of source code must retain                  |
// |    the above copyright notice, this list of conditions         |
// |    and the following disclaimer.                               |
// | 2. Redistributions in binary form must reproduce               |
// |    the above copyright notice, this list of conditions         |
// |    and the following disclaimer in the documentation           |
// |    and/or other materials provided with the distribution.      |
// | 3. Neither the name of ŁSL Scripting, nor the names            |
// |    of its contributors may be used to endorse or promote       |
// |    products derived from this software without specific        |
// |    prior written permission.                                   |
// +----------------------------------------------------------------+
// | This software is provided by the copyright holders             |
// | and contributors "as is" and any express or implied warranties |
// | including, but not limited to, the implied warranties          |
// | of merchantability and fitness for a particular purpose        |
// | are disclaimed. In no event shall the copyright holder         |
// | or contributors be liable for any direct, indirect,            |
// | incidental, special, exemplary, or consequential damages       |
// | including, but not limited to, procurement of substitute goods |
// | or services, loss of use, data, or profits,                    |
// | or business interruption, however caused and on any theory     |
// | of liability, whether in contract, strict liability,           |
// | or tort (including negligence or otherwise) arising in any way |
// | out of the use of this software, even if advised               |
// | of the possibility of such damage.                             |
// +----------------------------------------------------------------+
// ==UserScript==
// @name          Automatic Checkbox Unchecker
// @namespace     code.google.com/p/auto-checkbox-unchecker
// @description   Automatically unchecks any listed checkbox present on listed websites while running. This may be used to prevent installing crapware bundled with webinstalls by known vendors.
// @downloadURL   https://auto-checkbox-unchecker.googlecode.com/svn/stable/latest/auto_checkbox_unchecker.user.js
// @updateURL     https://auto-checkbox-unchecker.googlecode.com/svn/stable/latest/auto_checkbox_unchecker.meta.js
// @version       1.0.0
// @match         *://get.adobe.com/*/flashplayer*
// ==/UserScript==
// +----------------------------------------------------------------+

var filterDatabase = new Array(
							   new Array('get.adobe.com', 'input#offerCheckbox')
							   )

if ((typeof document.getElementsBySelector) == "undefined") {
	functionLoader = document.createElement("script");
	functionLoader.setAttribute("src", "http://www.openjs.com/scripts/dom/css_selector/css_selector.js");
	functionLoader.setAttribute("type", "text/javascript");
	document.body.appendChild(functionLoader);
}

window.uncheckCheckboxes = function uncheckCheckboxes() {
	for (iterator = 0; iterator < filterDatabase.length; iterator++) {
		if (window.location.href.match(filterDatabase[iterator][0])) {
			var checkboxes = window.getElementsBySelector(filterDatabase[iterator][1]);
			if (checkboxes.length > 0) {
				for (checkbox = 0; checkbox < checkboxes.length; checkbox++) {
					checkboxes[checkbox].checked = false;
				}
			}
		}
	}
}

uncheckCheckboxes();
window.setTimeout("uncheckCheckboxes();", 1000);